package com.ning.weixin.entity;

import java.io.Serializable;

/**
 * 用户信息
 *
 * @author Cyan
 * @Date:2018/12/09
 */
public class UserInfo implements Serializable {

    private static final long serialVersionUID = -1984810069457093209L;

    /**
     *  `userId` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户id',
     *  `nickName` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信昵称',
     *  `headImgUrl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信头像地址',
     *  `openId` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'openId',
     *  `score` int(16) NULL DEFAULT 0 COMMENT '用户积分',
     *  `clockNum` int(2) UNSIGNED NULL DEFAULT 1 COMMENT '线上打卡次数(默认为1次,分享和转发一次额外加10次)',
     *  `ClockAddress` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '打卡地点',
     *  `clockTime` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '打卡时间',
     *  `createTime` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间',
     *  `userName` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户姓名',
     *  `userTel` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户电话',
     *  `downClockNum` int(4) NULL DEFAULT 0 COMMENT '线下打卡次数(默认为0次,分享和转发一次额外加10次)',
     *  `shareStatus` int(2) NULL DEFAULT 0 COMMENT '分享状态(默认为0,分享之后则变为1)',
     *   PRIMARY KEY (`userId`) USING BTREE
     */

    /**
     * 用户id
     */
    private String userId;

    /**
     * 微信昵称
     */
    private String nickName;

    /**
     * 用户头像地址
     */
    private String headImgUrl;

    /**
     * openId
     * 用户标识
     */
    private String openId;

    /**
     * 积分数量
     */
    private Integer score;

    /**
     * 分享状态
     * 默认为0,分享之后则变为1
     * 如果该值已经变为1,则需要在逻辑层判断
     * 用户可以分享，但是线上打卡次数和线下
     * 打卡次数不再增加
     */
    private Integer shareStatus;

    /**
     * 线上打卡次数(默认为1,打卡后则-1)
     * 第一次分享之后额外获得一次打卡次数
     * 再次分享不再获得打卡次数
     */
    private Integer clockNum;

    /**
     * 线下打卡次数
     * 第一次分享之后额外获得10次打卡次数
     * 再次分享不再获得打卡次数
     */
    private Integer downClockNum;

    /**
     * 打卡地址
     */
    private String clockAddress;

    /**
     * 打卡时间
     */
    private String clockTime;

    /**
     * 用户真实姓名
     */
    private String userName;

    /**
     * 用户手机号码
     */
    private String userTel;

    /**
     * 扫码注册时间
     */
    private String createTime;

    public UserInfo() {
    }

    /**
     * 线上或者线下打卡次数减少
     *
     * @param openId
     * @param clockNum
     */
    public UserInfo(String openId, Integer clockNum) {
        this.openId = openId;
        this.clockNum = clockNum;
    }

    /**
     * 更新用户积分时的构造方法，
     * 同时打卡地点和打卡时间更新
     *
     * @param openId
     * @param score
     * @param clockAddress
     * @param clockTime
     */
    public UserInfo(String openId, Integer score,
                    String clockAddress, String clockTime) {
        this.openId = openId;
        this.score = score;
        this.clockAddress = clockAddress;
        this.clockTime = clockTime;
    }

    /**
     * 用户保存真实姓名和手机号码
     *
     * @param openId
     * @param userName
     * @param userTel
     */
    public UserInfo(String openId, String userName, String userTel) {
        this.openId = openId;
        this.userName = userName;
        this.userTel = userTel;
    }

    /**
     * 用户扫码或者其他方式进入公众号时
     * 获取的信息保存到数据库
     * score值为0
     * clockNume为1
     * downClockNum为0
     * shareStatus为0
     *
     * @param userId
     * @param nickName
     * @param headImgUrl
     * @param openId
     * @param score
     * @param shareStatus
     * @param clockNum
     * @param downClockNum
     * @param createTime
     */
    public UserInfo(String userId, String nickName, String headImgUrl, String openId,
                    Integer score, Integer shareStatus, Integer clockNum,
                    Integer downClockNum, String createTime) {
        this.userId = userId;
        this.nickName = nickName;
        this.headImgUrl = headImgUrl;
        this.openId = openId;
        this.score = score;
        this.shareStatus = shareStatus;
        this.clockNum = clockNum;
        this.downClockNum = downClockNum;
        this.createTime = createTime;
    }

    /**
     * 分享状态变为1
     * 同时线上打卡次数+1
     * 线下打卡次数+10
     *
     * @param openId
     * @param shareStatus
     * @param clockNum
     * @param downClockNum
     */
    public UserInfo(String openId, Integer shareStatus,
                    Integer clockNum, Integer downClockNum) {
        this.openId = openId;
        this.shareStatus = shareStatus;
        this.clockNum = clockNum;
        this.downClockNum = downClockNum;
    }

    public UserInfo(String openId, Integer shareStatus, Integer clockNum) {
        this.openId = openId;
        this.shareStatus = shareStatus;
        this.clockNum = clockNum;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getHeadImgUrl() {
        return headImgUrl;
    }

    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Integer getShareStatus() {
        return shareStatus;
    }

    public void setShareStatus(Integer shareStatus) {
        this.shareStatus = shareStatus;
    }

    public Integer getClockNum() {
        return clockNum;
    }

    public void setClockNum(Integer clockNum) {
        this.clockNum = clockNum;
    }

    public Integer getDownClockNum() {
        return downClockNum;
    }

    public void setDownClockNum(Integer downClockNum) {
        this.downClockNum = downClockNum;
    }

    public String getClockAddress() {
        return clockAddress;
    }

    public void setClockAddress(String clockAddress) {
        this.clockAddress = clockAddress;
    }

    public String getClockTime() {
        return clockTime;
    }

    public void setClockTime(String clockTime) {
        this.clockTime = clockTime;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserTel() {
        return userTel;
    }

    public void setUserTel(String userTel) {
        this.userTel = userTel;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
